#ifndef __TRACK_H_
#define __TRACK_H_

#include "main.h"

#define Base_Value 600
#define GET_PIN_VALUE(pin) ((DL_GPIO_readPins(Track_PORT, Track_##pin##_PIN) > 0) ? 0 : 1)

// 仅保留五路传感器定义
#define IN_X1   GET_PIN_VALUE(XIN1)
#define IN_X2   GET_PIN_VALUE(XIN2)
#define IN_X3   GET_PIN_VALUE(XIN3)
#define IN_X4   GET_PIN_VALUE(XIN4)
#define IN_X5   GET_PIN_VALUE(XIN5)

typedef struct{
    uint8_t Left;   
    uint8_t Right;
    uint8_t Border_Flag;
} Track_HonWai_Type;

volatile extern uint8_t Track_State;

void Data_Conver_Bin(uint8_t value);
void Track_Contorl(uint8_t State);
uint8_t Track_Read_State(void);
void vTrack_Base(uint8_t State);
uint8_t Track_Median_Filter_Handle(void);

#endif